package com.yiyang.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yiyang.domain.Result;
import com.yiyang.domain.po.Bed;
import com.yiyang.domain.po.Room;
import com.yiyang.service.BedService;
import com.yiyang.service.RoomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/beds")
public class BedController {
    @Autowired
    BedService bedService;

    @GetMapping("findBedByRoomNo")
    public Result<List<Bed>> findBedByRoomNo(Integer roomNo){
        QueryWrapper<Bed> qw = new QueryWrapper<Bed>();

        qw.eq("roomNo",roomNo)
                .eq("status",1);

        List<Bed> bedList = bedService.list(qw);
        return Result.success(bedList);
    }
}
